﻿using Prism.Mvvm;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ReactiveUI;
using Brutalmimi.Applicaiton.Share.Models;
using System.Windows.Input;
using Prism.Commands;
using Brutalmimi.Core.Ioc;
using Brutalmimi.Applicaiton.Share.Events;

namespace Brutalmimi.Application.Login.ViewModels
{
    public class LoginViewModel:ReactiveObject
    {
        public ICommand LoginCommand => new DelegateCommand(() => {

            if (string.IsNullOrEmpty(CurrentUser.UserName) || string.IsNullOrEmpty(CurrentUser.Password))
            {
                return;
            }
            PrismProvider.EventAggregator.GetEvent<LoginSuccessEvent>().Publish(CurrentUser);
            
        });
        public CurrentUser CurrentUser { get; set; } = new CurrentUser();
    }
}
